{extend name="pub/base" /}
{block name="title"}
<title>充值码管理</title>
{/block}

{block name="body"}
<section class="Hui-admin-article">
    <nav class="breadcrumb" style="background-color:#fff;padding: 0 24px"><i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span>
        充值码管理
        <span class="c-gray en">&gt;</span>
        充值码列表
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>
    <article class="Hui-admin-content clearfix">
        <div class="panel">
            <div class="panel-body">
                <div class="text-c">
                    <input type="text" placeholder="充值面额" style="width:250px" id="money" class="input-text">
                    <span class="select-box" style="width:150px;">
                            <select id="used" class="select" size="1">
                                <option value="" selected="selected">全部</option>
                                <option value="1">未使用</option>
                                <option value="2">已分发</option>
                               <option value="3">已使用</option>
                            </select>
                     </span>
                    <button type="submit" class="btn btn-success" onclick="search()"><i
                            class="Hui-iconfont">&#xe665;</i> 查询
                    </button>
                </div>
                <script>
                    function search() {
                        var money = $('#money').val();
                        var used = $('#used option:selected').val();
                        location.href = "search?used=" + used + "&money=" + money;
                    }
                </script>
            </div>
        </div>
        <div class="panel mt-20">
            <div class="panel-body">
                <div class="clearfix">
							<span class="f-l">
                                <a href="javascript:;" onclick="delAll('请选择要删除的码','chargecodes')" class="btn btn-danger radius">
                                    <i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
                                <a class="btn btn-primary radius" onclick="exp()" >
                                    导出
                                </a>
                                <script>
                                    function exp() {
                                        $.ajax({
                                            url:"{:url('chargecodes/export')}",
                                            type:'post',
                                            success:function (res) {
                                                layer.open({
                                                    title: '提示',
                                                    content: res.msg
                                                });
                                            }
                                        })
                                    }
                                </script>
                                <a class="btn btn-primary radius" href="{:url('chargecodes/detail')}">
                                    生成充值码
                                </a>
                                &nbsp;
                                <span style="color: red">注意！本功能是按照后台既有的配置来生成</span>
							</span>
                    <span class="f-r">共有数据：<strong>{$count}</strong> 条</span>
                </div>
                <div class="mt-20 clearfix">
                    <table class="table table-border table-bordered table-bg table-hover table-sort">
                        <thead>
                        <tr class="text-c">
                            <th><input id="cbx" type="checkbox" value=""></th>
                            <th>ID</th>
                            <th>充值码</th>
                            <th>面额</th>
                            <th>状态</th>
                            <th>创建时间</th>
                            <th>使用时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="codes" id="vo"}
                        <tr class="text-c">
                            <td><input data-val="{$vo.id}" class="cbx" type="checkbox" value=""></td>
                            <td>{$vo.id}</td>
                            <td>{$vo.code}</td>
                            <td>{$vo.money}</td>
                            <td>
                                {switch $vo.used}
                                {case 1}未使用{/case}
                                {case 2}已发出{/case}
                                {case 3}已使用{/case}
                                {default /}未使用
                                {/switch}
                            </td>
                            <td>{$vo.create_time|date='Y-m-d H:i:s'}</td>
                            <td>{$vo.update_time == $vo.create_time? '' : $vo.update_time|date='Y-m-d H:i:s'}</td>
                            <td class="f-14 td-manage">
                                <a style="text-decoration:none" class="ml-5" onclick="del(this,{$vo.id})" href="javascript:;"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    {$codes|raw}
                </div>
            </div>
        </div>
    </article>

</section>
{/block}